#include <iostream>
using namespace std;
int HalfPower(int x, int n)
{
	if (n==0)
		return 1;
	else
	{
		int result=1;
		while (n!=0)
		{
			if (n&1)
			{
				result *= x;
			}
			x *= x;
			n >>=1;
		}
		return result;
	}
}
void main ()
{
	printf ("%d\n",HalfPower(10,5));
	system ("pause");
}
